﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RoboTrocity.Code.ObjectStates {
	class BulletFlyingState:BulletState {
		public BulletFlyingState(Bullet bullet, Sprite newSprite)
			: base(bullet, newSprite) {
		}

		public override void PropelBullet() {
			AttachedBullet.Position += AttachedBullet.Velocity;
			AttachedBullet.Range -= (int)AttachedBullet.Velocity.Length();
			if (AttachedBullet.Range < 0) {
				AttachedBullet.CurrentState = new DeleteState();
			}
		}

		public override void Update(float elapsed) {
			PropelBullet();
			
		}

		public override void Collide() {
			AttachedBullet.Position += AttachedBullet.Velocity;
			AttachedBullet.CurrentState = AttachedBullet.getState(typeof(BulletCollidingState));

		}
	}
}
